package com.yang.SpringTest.annotation.lazyLearn;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * <p>测试类</p>
 *
 * @author By: chengxuyuanshitang
 * Package com.yang.SpringTest.annotation.lazyLearn
 * Ceate Time 2024-03-21 16:08
 */
@Slf4j
public class LazyDemoTest {
    public static void main(String[] args) {
        log.info("========== 创建IOC容器开始==========");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(LazyDemoConfig.class);
        log.info("==========创建IOC容器结束==========");

        log.info("==========IOC容器中获取Bean开始==========");
        LazyDemoBean demo1 = context.getBean(LazyDemoBean.class);
        LazyDemoBean demo2 = context.getBean(LazyDemoBean.class);
        log.info("**************** demo1是否等于demo2 : {}", (demo1 == demo2));
        log.info("==========从IOC容器中获取Bean结束==========");
        context.close();
    }
}

